<?php
/*****

Template Name: 首页模版

*****/
?>
<?php  get_header(); ?>
    <!--第一区块-->
    <div class="large left" id="largeleft">
    <div class="hotbox" id="hotbox">
	<div class="inewbox" id="news">
    <?php  
	$iglei_news_link = get_option('iglei_news_link');
	$iglei_news_title = get_option('iglei_news_title');
	
	$iglei_news_cn_id = get_option('iglei_news_cn_id');
	$iglei_news_id = get_option('iglei_news_id');
	?>
		<div class="border-n">
			<div class="hd">
				<div class="hdt">
					<a target="_blank" href="<?php echo $iglei_news_link; ?>"><?php echo $iglei_news_title;  ?></a>
				</div>
				<ul class="swc">
					<li class="on">国内</li>
					<li>综合</li>
				</ul>
			</div>
			<div class="newsbox">
				<ul class="newsboxs">
                <?php  
					$newid_cn = explode(',',$iglei_news_cn_id); 
					for($i=0;$i<=4;$i++){
						if($i == 0){
						$post = get_post($newid_cn[$i]);
						$post_title = $post->post_title;
						if(!$post){ $post = '无内容'; }
						$cat = get_the_category($newid_cn[$i]);
						$rand = rand(1,7);
						$cat = '<span class="c'.$rand.'">'.$cat[0]->name.'</span>';
						$imgshow = get_post_meta($newid_cn[$i],'news_img',true);
						if(empty($imgshow)){
							$imgshow = get_bloginfo('template_url')."/images/no_image.jpg";
						}
						echo '<li class="a1">
						<div class="imgbox">
							<img src="'.$imgshow.'">
						</div>
						<p class="t">
							'.$cat.'
							<a href="'.get_permalink($newid_cn[$i]).'" target="_blank">'.$post_title.'</a>
						</p>
						<p class="info">'.$post->post_excerpt.'</p>
					</li>';
						}else{
						$post2 = get_post($newid_cn[$i]);
						$post2 = $post2->post_title;
						if(!$post2){ $post2 = '无内容'; }
						$cat2 = get_the_category($newid_cn[$i]);
						$rand2 = rand(1,7);
						$cat2 = '<span class="c'.$rand2.'">'.$cat2[0]->name.'</span>';
						echo '<li>
						<p class="t">
							'.$cat2.'
							<a href="'.get_permalink($newid_cn[$i]).'" target="_blank">'.$post2.'</a>
						</p>
					</li>';
						}
					}	
				?>
					<div class="more">
						<span>部分国内的新闻信息</span>
						<a href="<?php echo $iglei_news_link; ?>" target="_blank">更多</a>
					</div>
				</ul>
                
                <ul class="newsboxs">
					<?php  
					$newid = explode(',',$iglei_news_id);
					for($i=0;$i<=4;$i++)
					{	
						if($i == 0){
						$post = get_post($newid[$i]);
						$post_title = $post->post_title;
						if(!$post){ $post = '无内容'; }
						$cat = get_the_category($newid[$i]);
						$rand = rand(1,7);
						$cat = '<span class="c'.$rand.'">'.$cat[0]->name.'</span>';
						$imgshow2 = get_post_meta($newid[$i],'news_img',true);
						if(empty($imgshow2)){
							$imgshow2 = get_bloginfo('template_url')."/images/no_image.jpg";
						}
						echo '<li class="a1">
						<div class="imgbox">
							<img src="'.$imgshow2.'">
						</div>
						<p class="t">
							'.$cat.'
							<a href="'.get_permalink($newid[$i]).'" target="_blank">'.$post_title.'</a>
						</p>
						<p class="info">'.$post->post_excerpt.'</p>
					</li>';
						}else{
						$post2 = get_post($newid[$i]);
						$post2 = $post2->post_title;
						if(!$post2){ $post2 = '无内容'; }
						$cat2 = get_the_category($newid[$i]);
						$rand2 = rand(1,7);
						$cat2 = '<span class="c'.$rand2.'">'.$cat2[0]->name.'</span>';
						echo '<li>
						<p class="t">
							'.$cat2.'
							<a href="'.get_permalink($newid[$i]).'" target="_blank">'.$post2.'</a>
						</p>
					</li>';
						}
					}	
				?>
					<div class="more">
						<span>部分国内的新闻信息</span>
						<a href="<?php echo $iglei_news_link; ?>" target="_blank">更多</a>
					</div>
				</ul>
                
			</div>
		</div>
	</div>
	<div class="hst_box right" id="qianglie">
        <?php  
	$iglei_tj_title = get_option('iglei_tj_title');
	$iglei_tj_link = get_option('iglei_tj_link');
	?>
		<div class="hd">
			<div class="hdt">
				<a class="recommend" href="<?php echo $iglei_tj_link; ?>"><?php echo $iglei_tj_title; ?></a>
			</div>
			<ul class="swc">
				<li class="on">昨日</li>
				<li>三日</li>
				<li>本周</li>
                <li style="display:none;">四日</li>
			</ul>
		</div>
		<div>
			<ul class="showbox">
                <?php most_viewed('','6','',$days = '-1',true,'post_type != "post" AND post_type != "page"'); ?>
			</ul>
            <ul class="showbox">
                <?php most_viewed('','6','',$days = '-3',true,'post_type != "post" AND post_type != "page"'); ?>
			</ul>
           <ul class="showbox">
				<?php most_viewed('','6','',$days = '-7',true,'post_type != "post" AND post_type != "page"'); ?>
			</ul>
            
		</div>
	</div>
</div>

        <div class="ad-b"><a href="http://moremoe.taobao.com/" target="_blank"><img src="<?php  bloginfo('template_url'); ?>/images/2012-09-13-01.jpg" border="0"></a></div>
        <!--专题-->
        <div class="z-l iv" id="special">
        <div class="hd"><div class="hdt"><a href="#">专题<b>Special</b></a></div><ul class="swc"><li class="on">热门关注</li><li>最近更新</li></ul></div>
        <div class="rec">
        	<ul class="recs">
			 <li><a href="#" target="_blank"><img src="<?php  bloginfo('template_url'); ?>/images/cbff7efb970351c9b0f71ceff6693dfe_m.jpg" title="凉宫春日的忧郁"></a><div class="title"><a href="#" target="_blank">凉宫春日的忧郁</a></div><div class="as">830人关注</div><div class="nu on">Video:27</div></li></ul>
             <ul class="recs">
				==============
			 </ul>
        </div>
        </div>
	<?php 
    $args=array(
      'public'   => true,
      '_builtin' => false
    ); 
    $output = 'names'; 
    $post_types=get_post_types($args,$output); 
      foreach ($post_types  as $post_type ) 
	  {
		if($post_type != 'specialt')
		{
			$obj = get_post_type_object($post_type);
			$loop = new WP_Query( array( 'post_type' => $post_type, 'posts_per_page' => 6 ) ); 
		   ?>
			<div class="ad-b2"></div>
			<div class="z-l iv" id="<?php echo $post_type; ?>"><div class="hd">
			<div class="hdt">
			<a class="douga" href="#" target="_blank"><?php  echo $obj->labels->singular_name; ?>
			<b style="text-transform:capitalize; margin-left:0;"><?php echo $post_type; ?></b></a>
			</div>
			<ul class="swc">
			<li class="on" ><b>最</b>高评分</li>
			<li>最新投稿</li>
			</ul>
			</div>
			<div class="vidbox">
			<div class="left">
			<ul>
            <?php          
			while ( $loop->have_posts() ) : $loop->the_post(); 
			$subtitle = get_post_meta($post->ID,'sub_title',true);
			if(!empty($subtitle)){
				$subt = $subtitle;
			}else{
				$subt = get_the_title();
			}
			$thumb = get_post_meta($post->ID,'show_image',true);
			if(!empty($thumb)){
				$thumb = '<img src="'.$thumb.'">';
			}else{
				$thumb = '<img src="'.get_bloginfo('template_url').'/images/no_image.jpg">';	
			}
			$start_time = get_post_meta($post->ID,'start_time',true);
			if(!empty($start_time)){
				$start_time = $start_time;
			}else{
				$start_time = '00:00';
			}
			$collect = get_post_meta($post->ID, '_postcollect', true);
			if(empty($collect)){ $collect = 0;}else{ $collect = $collect; }
			$integration = get_post_meta($post->ID, '_integration', true);
			if(empty($integration)){ $integration = 0;}else{ $integration = $integration; }	
			?>
			<div class="po" gk="<?php if(function_exists('the_views')) { the_views(); } ?>" sc="<?php echo $collect; ?>" pl="<?php comments_number( '0', '1', '%' ); ?>" dm="321" lm="undefined" tg="<?php the_time('Y-m-d'); ?>&nbsp;<?php the_time('H:i'); ?>" txt="<?php the_title(); ?>" subtitle="<?php echo $subt; ?>" pf="<?php echo $integration; ?>" up="<?php the_author(); ?>" yb="14"><a href="<?php the_permalink(); ?>" target="_blank"><?php echo $thumb; ?><div class="vbg"></div><div class="t"><?php the_title(); ?></div></a><div class="z"><i><?php echo $integration; ?></i><b><?php echo $start_time; ?></b></div><div class="i"><b class="c1">&nbsp;<?php if(function_exists('the_views')) { the_views(); } ?></b><b class="c2"><?php comments_number( '0', '1', '%' ); ?></b></div></div>
            <?php endwhile; ?>
			</ul>
			</div>
			<div class="right rec">
			<ul class="right_box">
            <?php high_score($post_type,'5'); ?>
            <div class="more"><span>获得评分最高的视频</span><a href="#" target="_blank">更多</a>
            </div>
			</ul>
            
			<ul class="right_box">
			<?php new_post_list($post_type,'5'); ?>
            <div class="more"><span>获得评分最高的视频</span><a href="#" target="_blank">更多</a>
			</ul>
			</div>
			
			</div>
			</div>
		<script>
		buildop("#<?php echo $post_type; ?> .swc li","#<?php echo $post_type; ?> .right_box");
		</script>     
		<?php 
	} }
	?>
    </div>
	<?php get_sidebar(); ?>
    <!--第一区块结束-->
    <div class="ad-e ad-e1"></div>
    <div class="c-link">
        <p class="c-t">友情连接 &amp; 合作伙伴<a href="http://bilibili.kankanews.com/html/link.html" class="b" target="_blank">更多&gt;&gt;</a></p>
        <div class="imgs">	
                <li><a href="http://www.smgbb.cn/" target="_blank"><img title="东方宽频" src="<?php  bloginfo('template_url'); ?>/images/smgbb-logo.jpg" width="88" border="0" height="31"></a> </li>
                <li><a href="http://www.kankanews.com/" target="_blank"><img title="看看新闻网" src="<?php  bloginfo('template_url'); ?>/images/smg-kankan.jpg" width="88" border="0" height="31"></a> </li>
                <li><a href="http://comic.qq.com/" target="_blank"><img title="腾迅动漫" src="<?php  bloginfo('template_url'); ?>/images/minilogo-tengxun.jpg" width="88" border="0" height="31"></a> </li>
                <li><a href="http://www.cctvdream.com.cn/" target="_blank"><img title="新科动漫" src="<?php  bloginfo('template_url'); ?>/images/xinkecctv.jpg" width="88" border="0" height="31"></a> </li>
                <li><a href="http://www.comic.gov.cn/" target="_blank"><img title="中国动漫网" src="<?php  bloginfo('template_url'); ?>/images/comic-gov-cn.jpg" width="88" border="0" height="31"></a> </li>
                <li><a href="http://comic.sina.com.cn/" target="_blank"><img title="新浪动漫" src="<?php  bloginfo('template_url'); ?>/images/sinadongman.jpg" width="88" border="0" height="31"></a> </li>
                <li><a href="http://comic.zongheng.com/" target="_blank"><img title="纵横动漫原创漫画平台" src="<?php  bloginfo('template_url'); ?>/images/comicyu.gif" width="88" border="0" height="31"></a> </li>
                <li><a href="http://www.17dm.com/" target="_blank"><img title="一起动漫" src="<?php  bloginfo('template_url'); ?>/images/logo_17dm.gif" width="88" border="0" height="31"></a> </li>
                <li><a href="http://manhua.uuu9.com/" target="_blank"><img title="游久动漫" src="<?php  bloginfo('template_url'); ?>/images/s-uuu9.png" width="88" border="0" height="31"></a> </li>
                <li><a href="http://bbs.comicdd.com/" target="_blank"><img title="动漫东东" src="<?php  bloginfo('template_url'); ?>/images/s-comicdd.gif" width="88" border="0" height="31"></a> </li>
                <li><a href="http://www.u17.com/" target="_blank"><img title="有妖气漫画" src="<?php  bloginfo('template_url'); ?>/images/s-u17.gif" width="88" border="0" height="31"></a> </li>
                <li><a href="http://www.emland.net/" target="_blank"><img title="恶魔岛动漫世界" src="<?php  bloginfo('template_url'); ?>/images/1204241500278984.jpg" width="88" border="0" height="31"></a> </li>
                <li><a href="http://jandan.net/" target="_blank"><img title="煎蛋" src="<?php  bloginfo('template_url'); ?>/images/Jandan-88x31.gif" width="88" border="0" height="31"></a> </li>
                <li><a href="http://www.ishangman.com/" target="_blank"><img title="i尚漫原创漫画" src="<?php  bloginfo('template_url'); ?>/images/s-ishangman.jpg" width="88" border="0" height="31"></a> </li>
                <li><a href="http://www.tuita.com/" target="_blank"><img title="推他" src="<?php  bloginfo('template_url'); ?>/images/tuita-logo.jpg" width="88" border="0" height="31"></a> </li>
            </div>
        <div class="yq">
            <a href="http://www.bilibili.tv/" target="_blank" title="嗶哩嗶哩弹幕视频网"><img src="<?php  bloginfo('template_url'); ?>/images/mini-logo.gif"></a>
        </div>
    </div>  
<?php  get_footer(); ?>   